function submit() {
	var username = $('#username').val();
	var password = $('#password').val();
	//encodeBase64($('#password').val(),1);
	$.ajax({
		url:'https://www.maksdu.com/app/pwd/login',
		method:'post',
		data: {
			username:username,
			password:password
		},
		success:function(data) {
			
			if(data.code && data.code ===200) {
				data = data.result.value;
				
				window.localStorage.clear();
				window.localStorage.setItem('token',data.token);
				if(data.userinfo && data.userinfo.roles.roleName=='ADMIN') {
					var userinfo = data.userinfo;
					console.info(userinfo);
					window.localStorage.setItem('username',userinfo.name);
					window.localStorage.setItem('permissons',userinfo.permissions);
					window.localStorage.setItem('lastLoginTime',userinfo.lastLoginTime);
					window.localStorage.setItem('timeOutMixnum',30);
					window.localStorage.setItem('isLogin',true);
					console.info("登录成功");
					setTimeout("window.location.href='main'", 2000);
				}
						
			} else {
				console.info("用户登录失败");
			}
		}
	});
}

// window.onload = function() {
// 	$.ajax({
// 		url:'http://yyja.maksdu.com/user/registry',
// 		method:'post',
// 		data: {
// 			username:'admin',
// 			password: encodeBase64('admin',1)
// 		},
// 		success:function(data) {
// 			console.info('注册成功:'+data.username);
// 		}
// 	});
// }

function encodeBase64(mingwen,times){
  var code="";
  var num=1;
  if(typeof times=='undefined'||times==null||times==""){
    num=1;
  }else{
    var vt=times+"";
    num=parseInt(vt);
  }
  if(typeof mingwen=='undefined'||mingwen==null||mingwen==""){
  }else{
    $.base64.utf8encode = true;
    code=mingwen;
    for(var i=0;i<num;i++){
      code=$.base64.btoa(code);
    }
  }
  return code;
}
